package com.csh.utils;

/**
 * @author 军哥
 * @version 1.0
 * @description: ResultResponse
 * @date 2022/8/2 15:40
 */

public class ResultResponse {
    private int code;
    private String msg;
    private Object data;

    private ResultResponse() {

    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public static ResultResponse SUCCESS() {
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.setCode(200);
        resultResponse.setMsg("操作成功");

        return resultResponse;
    }

    public static ResultResponse SUCCESS(Object data) {
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.setCode(200);
        resultResponse.setData(data);
        resultResponse.setMsg("操作成功");

        return resultResponse;
    }

    public static ResultResponse FAILED(int code) {
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.setCode(code);
        resultResponse.setMsg("操作失败");

        return resultResponse;
    }

    public static ResultResponse FAILED(int code, String msg) {
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.setCode(code);
        resultResponse.setMsg(msg);

        return resultResponse;
    }

}
